home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1989 …il & Dave's Excellent CD / Excellent CD HFS.raw / Moof / Goodies / MPW Goodies / Interfaces / CIncludes / Fonts.h < prev    next >
Encoding:
C/C++ Source or Header  |  1988-11-30  |  7.0 KB  |  279 lines  |  [TEXT/MPS ]

  1. /************************************************************
  2.  
  3. Created: Tuesday, October 4, 1988 at 6:29 PM
  4.     Fonts.h
  5.     C Interface to the Macintosh Libraries
  6.  
  7.  
  8.     Copyright Apple Computer, Inc.  1985-1988
  9.     All rights reserved
  10.  
  11. ************************************************************/
  12.  
  13.  
  14. #ifndef __FONTS__
  15. #define __FONTS__
  16.  
  17. #ifndef __TYPES__
  18. #include <Types.h>
  19. #endif
  20.  
  21. #define systemFont 0
  22. #define applFont 1
  23. #define newYork 2
  24. #define geneva 3
  25. #define monaco 4
  26. #define venice 5
  27. #define london 6
  28. #define athens 7
  29. #define sanFran 8
  30. #define toronto 9
  31. #define cairo 11
  32. #define losAngeles 12
  33. #define times 20
  34. #define helvetica 21
  35. #define courier 22
  36. #define symbol 23
  37. #define mobile 24
  38. #define commandMark 17
  39. #define checkMark 18
  40. #define diamondMark 19
  41. #define appleMark 20
  42. #define propFont 36864
  43. #define prpFntH 36865
  44. #define prpFntW 36866
  45. #define prpFntHW 36867
  46. #define fixedFont 45056
  47. #define fxdFntH 45057
  48. #define fxdFntW 45058
  49. #define fxdFntHW 45059
  50. #define fontWid 44208
  51.  
  52. struct FMInput {
  53.     short family;
  54.     short size;
  55.     Style face;
  56.     Boolean needBits;
  57.     short device;
  58.     Point numer;
  59.     Point denom;
  60. };
  61.  
  62. #ifndef __cplusplus
  63. typedef struct FMInput FMInput;
  64. #endif
  65.  
  66. struct FMOutput {
  67.     short errNum;
  68.     Handle fontHandle;
  69.     unsigned char boldPixels;
  70.     unsigned char italicPixels;
  71.     unsigned char ulOffset;
  72.     unsigned char ulShadow;
  73.     unsigned char ulThick;
  74.     unsigned char shadowPixels;
  75.     char extra;
  76.     unsigned char ascent;
  77.     unsigned char descent;
  78.     unsigned char widMax;
  79.     char leading;
  80.     char unused;
  81.     Point numer;
  82.     Point denom;
  83. };
  84.  
  85. #ifndef __cplusplus
  86. typedef struct FMOutput FMOutput;
  87. #endif
  88.  
  89. typedef FMOutput *FMOutPtr;
  90.  
  91. struct FontRec {
  92.     short fontType;         /*font type*/
  93.     short firstChar;        /*ASCII code of first character*/
  94.     short lastChar;         /*ASCII code of last character*/
  95.     short widMax;           /*maximum character width*/
  96.     short kernMax;          /*negative of maximum character kern*/
  97.     short nDescent;         /*negative of descent*/
  98.     short fRectWidth;       /*width of font rectangle*/
  99.     short fRectHeight;      /*height of font rectangle*/
  100.     short owTLoc;           /*offset to offset/width table*/
  101.     short ascent;           /*ascent*/
  102.     short descent;          /*descent*/
  103.     short leading;          /*leading*/
  104.     short rowWords;         /*row width of bit image / 2 */
  105. };
  106.  
  107. #ifndef __cplusplus
  108. typedef struct FontRec FontRec;
  109. #endif
  110.  
  111. struct FMetricRec {
  112.     Fixed ascent;           /*base line to top*/
  113.     Fixed descent;          /*base line to bottom*/
  114.     Fixed leading;          /*leading between lines*/
  115.     Fixed widMax;           /*maximum character width*/
  116.     Handle wTabHandle;      /*handle to font width table*/
  117. };
  118.  
  119. #ifndef __cplusplus
  120. typedef struct FMetricRec FMetricRec;
  121. #endif
  122.  
  123. struct WidEntry {
  124.     short widStyle;         /*style entry applies to*/
  125. };
  126.  
  127. #ifndef __cplusplus
  128. typedef struct WidEntry WidEntry;
  129. #endif
  130.  
  131. struct WidTable {
  132.     short numWidths;        /*number of entries - 1*/
  133. };
  134.  
  135. #ifndef __cplusplus
  136. typedef struct WidTable WidTable;
  137. #endif
  138.  
  139. struct AsscEntry {
  140.     short fontSize;
  141.     short fontStyle;
  142.     short fontID;           /*font resource ID*/
  143. };
  144.  
  145. #ifndef __cplusplus
  146. typedef struct AsscEntry AsscEntry;
  147. #endif
  148.  
  149. struct FontAssoc {
  150.     short numAssoc;         /*number of entries - 1*/
  151. };
  152.  
  153. #ifndef __cplusplus
  154. typedef struct FontAssoc FontAssoc;
  155. #endif
  156.  
  157. struct StyleTable {
  158.     short fontClass;
  159.     long offset;
  160.     long reserved;
  161.     char indexes[48];
  162. };
  163.  
  164. #ifndef __cplusplus
  165. typedef struct StyleTable StyleTable;
  166. #endif
  167.  
  168. struct NameTable {
  169.     short stringCount;
  170.     Str255 baseFontName;
  171. };
  172.  
  173. #ifndef __cplusplus
  174. typedef struct NameTable NameTable;
  175. #endif
  176.  
  177. struct KernPair {
  178.     char kernFirst;         /*1st character of kerned pair*/
  179.     char kernSecond;        /*2nd character of kerned pair*/
  180.     short kernWidth;        /*kerning in 1pt fixed format*/
  181. };
  182.  
  183. #ifndef __cplusplus
  184. typedef struct KernPair KernPair;
  185. #endif
  186.  
  187. struct KernEntry {
  188.     short kernLength;       /*length of this entry*/
  189.     short kernStyle;        /*style the entry applies to*/
  190. };
  191.  
  192. #ifndef __cplusplus
  193. typedef struct KernEntry KernEntry;
  194. #endif
  195.  
  196. struct KernTable {
  197.     short numKerns;         /*number of kerning entries*/
  198. };
  199.  
  200. #ifndef __cplusplus
  201. typedef struct KernTable KernTable;
  202. #endif
  203.  
  204. struct WidthTable {
  205.     Fixed tabData[256];     /*character widths*/
  206.     Handle tabFont;         /*font record used to build table*/
  207.     long sExtra;            /*space extra used for table*/
  208.     long style;             /*extra due to style*/
  209.     short fID;              /*font family ID*/
  210.     short fSize;            /*font size request*/
  211.     short face;             /*style (face) request*/
  212.     short device;           /*device requested*/
  213.     Point inNumer;          /*scale factors requested*/
  214.     Point inDenom;          /*scale factors requested*/
  215.     short aFID;             /*actual font family ID for table*/
  216.     Handle fHand;           /*family record used to build up table*/
  217.     Boolean usedFam;        /*used fixed point family widths*/
  218.     unsigned char aFace;    /*actual face produced*/
  219.     short vOutput;          /*vertical scale output value*/
  220.     short hOutput;          /*horizontal scale output value*/
  221.     short vFactor;          /*vertical scale output value*/
  222.     short hFactor;          /*horizontal scale output value*/
  223.     short aSize;            /*actual size of actual font used*/
  224.     short tabSize;          /*total size of table*/
  225. };
  226.  
  227. #ifndef __cplusplus
  228. typedef struct WidthTable WidthTable;
  229. #endif
  230.  
  231. struct FamRec {
  232.     short ffFlags;          /*flags for family*/
  233.     short ffFamID;          /*family ID number*/
  234.     short ffFirstChar;      /*ASCII code of 1st character*/
  235.     short ffLastChar;       /*ASCII code of last character*/
  236.     short ffAscent;         /*maximum ascent for 1pt font*/
  237.     short ffDescent;        /*maximum descent for 1pt font*/
  238.     short ffLeading;        /*maximum leading for 1pt font*/
  239.     short ffWidMax;         /*maximum widMax for 1pt font*/
  240.     long ffWTabOff;         /*offset to width table*/
  241.     long ffKernOff;         /*offset to kerning table*/
  242.     long ffStylOff;         /*offset to style mapping table*/
  243.     short ffProperty[9];    /*style property info*/
  244.     short ffIntl[2];        /*for international use*/
  245.     short ffVersion;        /*version number*/
  246. };
  247.  
  248. #ifndef __cplusplus
  249. typedef struct FamRec FamRec;
  250. #endif
  251.  
  252. #ifdef __safe_link
  253. extern "C" {
  254. #endif
  255. pascal void InitFonts(void)
  256.     = 0xA8FE; 
  257. pascal void GetFontName(short familyID,Str255 theName)
  258.     = 0xA8FF; 
  259. pascal void GetFNum(const Str255 theName,short *familyID)
  260.     = 0xA900; 
  261. pascal Boolean RealFont(short fontNum,short size)
  262.     = 0xA902; 
  263. pascal void SetFontLock(Boolean lockFlag)
  264.     = 0xA903; 
  265. pascal FMOutPtr FMSwapFont(const FMInput *inRec)
  266.     = 0xA901; 
  267. pascal void SetFScaleDisable(Boolean fscaleDisable)
  268.     = 0xA834; 
  269. pascal void FontMetrics(const FMetricRec *theMetrics)
  270.     = 0xA835; 
  271. pascal void SetFractEnable(Boolean fractEnable); 
  272. void getfnum(char *theName,short *familyID); 
  273. void getfontname(short familyID,char *theName); 
  274. #ifdef __safe_link
  275. }
  276. #endif
  277.  
  278. #endif
  279.